﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using RuleCode.Table;

namespace chatblog
{
    public partial class _default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                cbuser.dealcookie();
                //dealrequest();
                bind1();
                //bind2();
                //bind3();
            }
        }
        private void bind1()
        {
            cbuser u = cbuser.Find("");
            this.WebPager_bloglist.DataSource = u.MyTable;
            this.WebPager_bloglist.DataBind();
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            if (AliApi.appUserId != "")
            {
                Response.Redirect(ResolveUrl("~/blog/") + AliApi.appDomainID + ".html");
            }
            else
            {
                Response.Redirect(ResolveUrl("~/login/login.aspx") + "?redirecturl=" + ResolveUrl("~/blog.aspx"));
            }
        }

        protected void Button2_Click(object sender, EventArgs e)
        {
            if (AliApi.appUserId != "")
            {
                Response.Redirect(ResolveUrl("~/blog/blogmanage.aspx") + "?userid=" + AliApi.appDomainID);
            }
            else
            {
                Response.Redirect(ResolveUrl("~/login/login.aspx") + "?redirecturl=" + ResolveUrl("~/blog/blogmanage.aspx"));
            }
        }

        protected void WebPager_bloglist_PageIndexChanged(object sender, RuleCode.Controls.PageChangedEventArgs e)
        {
            bind1();
            WebPager_bloglist.CurrentPageIndex = e.NewPageIndex;
        }
    }
}
